//客户筛选管理CreateInfo.js  网格下的内容控件 ProjectSource.js

var ProjectSourceDemo = function(){
	
	var userSelector = null;
	var selectUserId = [];
	
	// 立项信息元素-----begin

	var customerID = new Ext.form.TextField({
		fieldLabel : '客户编号',
		width : 150,
		disabled:true
	});
	
	var customerName = new Ext.form.TextField({
		fieldLabel : '客户名称',
		width : 300,
		allowBlank : false
	});
	var customerArea = new Ext.form.ComboBox( {
		fieldLabel : '所属区域',
		store: OMS.AREA,
		mode : 'local',
		displayField : 'name',
		triggerAction : 'all',
		editable : false,
		valueField : 'id',
		typeAhead : true,
		width : 150,
		emptyText : '---请选择---',
		selectOnFocus : true
	});
	
	
	this.renderprojectType = function(value){
		return OMS.PROJECTTYPEOBJECT[value];
	};
	
	var projectType = new Ext.form.ComboBox( {
		fieldLabel : '客户类型',
		//hiddenName : 'type',
		store : OMS.PROJECTTYPE,
		mode : 'local',
		displayField : 'name',
		triggerAction : 'all',
		editable : false,
		valueField : 'id',
		typeAhead : true,
		width : 150,
		emptyText : '---请选择---',
		selectOnFocus : true,
		allowBlank : false
	});
	var serviceStartDate = new Ext.form.DateField({//projectJoinHeader
		fieldLabel : '预约时间',
		format : 'Y-m-d',
		width : 150
	});
	
	var serviceAddress = new Ext.form.TextField({
		fieldLabel : '维修地址',
		width : 300,
		allowBlank : false
	});
	
	
	
	var connName = new Ext.form.TextField({
		fieldLabel : '联系人姓名',
		width : 120,
		allowBlank : false
	});
	
	var connOffTel = new Ext.form.TextField({
		fieldLabel : '办公电话',
		width : 120,
		allowBlank : false
	});
	
	var connCellPhone = new Ext.form.TextField({
		fieldLabel : '手机',
		width : 120
	});
	
	var connEmail = new Ext.form.TextField({
		fieldLabel : 'EMAIL',
		width : 120,
		vtype : 'email'
	});

	
	this.projectInfo = new Ext.form.FieldSet({
		title : '回访信息',
		collapsible : true,
		autoHeight : true,
		width : 930,
		items : [{layout:'column',
				  defaults:{layout:'form'},
					  items:[{columnWidth:0.5,items:[customerID]},
					         {columnWidth:0.5,items:[customerName]}]},
				  {layout:'column',
				   defaults:{layout:'form'},
					   items:[{items:[customerArea,serviceStartDate]},
							  {items:[serviceAddress]}
							  ]},
				   {xtype:'fieldset',title:'回访明细信息',collapsible:true,autoHeight:true,
					items:[{layout:'column',
						   defaults:{layout:'form'},
						   items:[{columnWidth:0.5,items:[customerName]}
						   		
						   ]},
						  {layout:'column',
						   defaults:{layout:'form'},
						   items:[{columnWidth:0.25,items:[connName]},
								  {columnWidth:0.25,items:[connOffTel]},
								  {columnWidth:0.25,items:[connCellPhone]},
								  {columnWidth:0.25,items:[connEmail]}
								 ]
						  }]}
				]
	});
	
	
	
	
	
	var projectNeedSummary = new Ext.form.TextArea({
		fieldLabel : '备注',
		width : 800
	});
	
	// 需求信息元素----end
	
	
	//为控件设置值
	this.setCompValue = function(data){
		
		connName.setValue(data.CONTACT_PERSON);
		connOffTel.setValue(data.OFF_TEL);
		connCellPhone.setValue(data.MOBILE);
		connEmail.setValue(data.EMIAL);
		
		
	};
	//为控件设置值
	this.setCompValueAndDisabled = function(data){
		customerID.setValue(data.id);
		customerArea.setValue(data.Area);
		customerName.setValue(data.CustomerName);
	};
	//取得控件里的值
	this.getServiceAddress=function(){
			value = serviceAddress.getValue();
			return value;
	
	}
	

	
	this.getCustomerID= function(){
			value = customerID.getValue();
			return value;
		};
	this.getCustomerName= function(){
			value = customerName.getValue();
			return value;
		};	
	this.getCustomerArea=function(){
			value = customerArea.getValue();
			return value;
		};
	this.getServiceStartDate=function(){
			value=serviceStartDate.getValue()?serviceStartDate.getValue().format('Y-m-d') : '';
			return value;
	}
	this.getConnName=function(){
			value=connName.getValue();
			return value;
	}
	this.getConnOffTele=function(){
			value=connOffTel.getValue();
			return value;
	}
	this.getConnCellPhone=function(){
			value=connCellPhone.getValue();
			return value;
	}
	this.getConnEmail=function(){
			value=connEmail.getValue();
			return value;
	}
	
	
	
};